package com.wqmei.filter;

import java.io.IOException;
import java.net.URLDecoder;
import java.nio.charset.Charset;

import javax.json.JsonObject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

import org.apache.commons.io.IOUtils;


public class RequestWrapper extends HttpServletRequestWrapper{
	private byte[] body;
	public RequestWrapper(HttpServletRequest request) throws IOException {
		super(request);
		if(request.getMethod().equals("GET")){
			String queryString = request.getQueryString();
			if(queryString==null){
				queryString="{}";
			}
			queryString = URLDecoder.decode(queryString, "UTF-8");
			body=queryString.getBytes(Charset.forName("UTF-8"));
		}else{
			 body=request.getInputStream().toString().getBytes(Charset.forName("UTF-8"));
			
			 
		}
	}
	

}
